﻿using QuanLyNganHangDe.BLL;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace QuanLyNganHangDe.GUI.DuLieu
{
    public partial class FormChuyenKhoi : Form
    {
        string maCauHoi;
        public FormChuyenKhoi(string maCauHoi)
        {
            InitializeComponent();
            this.maCauHoi = maCauHoi;
            NapDanhSachKhoi();
        }

        private void btnOK_Click(object sender, EventArgs e)
        {
            if (cbxKhoi.SelectedIndex != -1)
                if (BizCauHoi.UpdateKhoi(maCauHoi, cbxKhoi.SelectedValue.ToString()) == 1)
                    this.DialogResult = System.Windows.Forms.DialogResult.OK;
                else
                    DialogUtils.ShowError("Không thể đổi khối cho câu hỏi này");
        }
        void NapDanhSachKhoi()
        {
            bsKhoi.DataSource = BizCauHoi.GetListKhoi(maCauHoi);
            cbxKhoi.DataSource = bsKhoi;
            cbxKhoi.DisplayMember = "TenKhoi";
            cbxKhoi.ValueMember = "MaKhoi";
        }
    }
}
